<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../../icon/iconfont.css" />
    <style>
        header{
          padding: 1.6rem 0.8rem 0.8rem 0.8rem;
          overflow: hidden;
          background-color: #fff;
          width: 100%;
          line-height: 1rem;
          border-bottom: 1px solid rgb(187, 187, 187);
        }
        .left{
          float: left;
        }
        header .left span:nth-of-type(1){
          font-size: 1rem;
        }
        header .left span:nth-of-type(2){
          font-size: 1rem;
        }
        header .right{
          vertical-align: top;
          font-size: 1.3rem;
          float: right;
        }


    </style>
</head>

<body>
  <div class="hezuo">
    <header>
      <div class="left">
        <span class="iconfont icon-fanhui" onClick="api.closeWin()"></span>
        <span>商务合作</span>
      </div>
    </header>
    <p style="text-align:center;font-size:0.8rem;color:#000;margin-top:4rem">如需商务合作请添加微信：MysteriousBug</p>
    <img src="http://cloud.jinshouzhou.com/20190615115750.jpg" alt="" id="img">
  </div>
</body>
<script type="text/javascript" src="../../../script/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../../../script/api.js"></script>
<script type="text/javascript" src="../../../script/dns.js"></script>
<script type="text/javascript" src="../../../lib/artTemplate/template.js"></script>

<script type="text/javascript">
    apiready = function() {

    };
    $("#img").click(function () {
      var imgList = [];
      imgList.push($(this).attr("src"))
      var photoBrowser = api.require('photoBrowser');
      photoBrowser.open({
          images: imgList,
          placeholderImg: 'widget://res/img/apicloud.png',
          bgColor: '#000',

      }, function(ret, err) {
          if (ret.eventType == 'click') {
              photoBrowser.close()
          }
          if (ret.eventType == 'longPress') {
            var a = Math.floor(Math.random()*1000);
            api.download({
                url: imgList[ret.index],
                savePath: 'fs://'+a+'.jpg',
                report: true,
                cache: false
            }, function(ret, err) {
                if (ret.state == 1) {
                    //下载成功
                    // console.log("下载成功");
                    // 保存图片
                    api.saveMediaToAlbum({
                      path :ret.savePath
                    }, function(ret, err) {
                        if (ret.status==true) {
                          alert("保存成功!")
                        } else {
                        }
                    });
                } else {

                }
            });
          }
           else {
              // alert(JSON.stringify(err));
          }
      });
    })
</script>

</html>
